import 'package:distribution_mall_flutter/generated/json/base/json_convert_content.dart';
import 'package:distribution_mall_flutter/provider/delete_account/delete_account_verify.dart';
import 'dart:async';

import 'package:distribution_mall_flutter/constant/constant.dart';

import 'package:distribution_mall_flutter/dialog/delete_account_check_dialog.dart';

import 'package:distribution_mall_flutter/entity/delete_account/delete_account_check_entity.dart';

import 'package:distribution_mall_flutter/entity/delete_account/delete_account_send_code_entity.dart';

import 'package:distribution_mall_flutter/ext/riverpod_ext.dart';

import 'package:distribution_mall_flutter/http/modules/delete_account.dart';

import 'package:distribution_mall_flutter/utils/debug.dart';

import 'package:distribution_mall_flutter/router/router.gr.dart';

import 'package:distribution_mall_flutter/utils/storage.dart';

import 'package:flutter/material.dart';

import 'package:phone_numbers_parser/phone_numbers_parser.dart';

import 'package:riverpod/riverpod.dart';

import 'package:riverpod_annotation/riverpod_annotation.dart';


DeleteAccountSendCodeState $DeleteAccountSendCodeStateFromJson(
    Map<String, dynamic> json) {
  final DeleteAccountSendCodeState deleteAccountSendCodeState = DeleteAccountSendCodeState();
  final SendCodeState? type = jsonConvert.convert<SendCodeState>(
      json['type'], enumConvert: (v) => SendCodeState.values.byName(v));
  if (type != null) {
    deleteAccountSendCodeState.type = type;
  }
  final int? countDown = jsonConvert.convert<int>(json['countDown']);
  if (countDown != null) {
    deleteAccountSendCodeState.countDown = countDown;
  }
  final DeleteAccountSendCodeBody? codeResponse = jsonConvert.convert<
      DeleteAccountSendCodeBody>(json['codeResponse']);
  if (codeResponse != null) {
    deleteAccountSendCodeState.codeResponse = codeResponse;
  }
  return deleteAccountSendCodeState;
}

Map<String, dynamic> $DeleteAccountSendCodeStateToJson(
    DeleteAccountSendCodeState entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['type'] = entity.type.name;
  data['countDown'] = entity.countDown;
  data['codeResponse'] = entity.codeResponse?.toJson();
  return data;
}

extension DeleteAccountSendCodeStateExtension on DeleteAccountSendCodeState {
  DeleteAccountSendCodeState copyWith({
    SendCodeState? type,
    int? countDown,
    DeleteAccountSendCodeBody? codeResponse,
  }) {
    return DeleteAccountSendCodeState()
      ..type = type ?? this.type
      ..countDown = countDown ?? this.countDown
      ..codeResponse = codeResponse ?? this.codeResponse;
  }
}